package br.com.cqipac.dao;

// Generated 22/05/2008 20:16:55 by Hibernate Tools 3.2.1.GA

import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import br.com.cqipac.to.SetorFuncionario;
import br.com.cqipac.to.SetorFuncionarioId;

/**
 * Home object for domain model class SetorFuncionario.
 * @see br.com.cqipac.to.SetorFuncionario
 * @author Hibernate Tools
 */
@Stateless
public class SetorFuncionarioHome {

	private static final Log log = LogFactory
			.getLog(SetorFuncionarioHome.class);

	@PersistenceContext
	private EntityManager entityManager;

	public void persist(SetorFuncionario transientInstance) {
		log.debug("persisting SetorFuncionario instance");
		try {
			entityManager.persist(transientInstance);
			log.debug("persist successful");
		} catch (RuntimeException re) {
			log.error("persist failed", re);
			throw re;
		}
	}

	public void remove(SetorFuncionario persistentInstance) {
		log.debug("removing SetorFuncionario instance");
		try {
			entityManager.remove(persistentInstance);
			log.debug("remove successful");
		} catch (RuntimeException re) {
			log.error("remove failed", re);
			throw re;
		}
	}

	public SetorFuncionario merge(SetorFuncionario detachedInstance) {
		log.debug("merging SetorFuncionario instance");
		try {
			SetorFuncionario result = entityManager.merge(detachedInstance);
			log.debug("merge successful");
			return result;
		} catch (RuntimeException re) {
			log.error("merge failed", re);
			throw re;
		}
	}

	public SetorFuncionario findById(SetorFuncionarioId id) {
		log.debug("getting SetorFuncionario instance with id: " + id);
		try {
			SetorFuncionario instance = entityManager.find(
					SetorFuncionario.class, id);
			log.debug("get successful");
			return instance;
		} catch (RuntimeException re) {
			log.error("get failed", re);
			throw re;
		}
	}
}
